package com.usian.user.controller;

import com.usian.apis.user.ApUserRealnameControllerApi;
import com.usian.common.constants.user.UserConstants;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.user.mapper.ApUserMapper;
import com.usian.user.service.UserRealnameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.awt.windows.WEmbeddedFrame;

@RestController
@RequestMapping("api/v1/authDto")
public class UserRealnameController implements ApUserRealnameControllerApi {

    @Autowired
    private UserRealnameService userRealnameService;

    @RequestMapping("list")
    @Override
    public ResponseResult loadListByStatus(@RequestBody AuthDto authDto) {
        return userRealnameService.loadListByStatus(authDto);
    }

    @PostMapping("/authPass")
    @Override
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        return userRealnameService.updateStatusById(dto, UserConstants.PASS_AUTH);
    }

    @PostMapping("/authFail")
    @Override
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        return userRealnameService.updateStatusById(dto, UserConstants.FAIL_AUTH);
    }
    @Override
    public ResponseResult updateStatusById(AuthDto dto, Short status) {
        return userRealnameService.updateStatusById(dto,status);
    }
}
